//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//********************************************************* 

using System;
using System.Drawing;
using System.Xml.Serialization;

namespace Microsoft.TridentWordAddIn.Common
{
    [XmlRoot("WorkflowAssociation")]
    public class WorkflowAssociation : DomainBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkflowAssociation"/> class.
        /// </summary>
        public WorkflowAssociation()
        {
            this.LocalId = -1;
            this.Job = new WorkflowJob();
            this.RerunJob = new RerunJob();
        }

        /// <summary>
        /// Gets or sets the local id.
        /// </summary>
        /// <value>The local id.</value>
        [DoNotCompare]
        public int LocalId { get; set; }

        /// <summary>
        /// Gets or sets the workflow id.
        /// </summary>
        /// <value>The workflow id.</value>
        public Guid WorkflowId { get; set; }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the annotation.
        /// </summary>
        /// <value>The annotation.</value>
        public string Annotation { get; set; }

        /// <summary>
        /// Gets or sets the job.
        /// </summary>
        /// <value>The job.</value>
        public WorkflowJob Job { get; set; }

        /// <summary>
        /// Gets or sets the rerun job.
        /// </summary>
        /// <value>The rerun job.</value>
        [DoNotCompare]
        [XmlIgnore]
        public RerunJob RerunJob { get; set; }

        /// <summary>
        /// Gets or sets the picture.
        /// </summary>
        /// <value>The picture.</value>
        public DocumentPicture Picture { get; set; }

        /// <summary>
        /// Gets or sets the thumbnail image.
        /// </summary>
        /// <value>The thumbnail image.</value>
        [XmlIgnore]
        [DoNotCompare]
        public Image ThumbnailImage { get; set; }

        /// <summary>
        /// Gets or sets the serialized thumbnail image.
        /// </summary>
        /// <value>The serialized thumbnail image.</value>
        [DoNotCompare]
        public byte[] SerializedThumbnailImage
        {
            get
            {
                return this.ThumbnailImage.SerializedImage();
            }
            set
            {
                this.ThumbnailImage = ImageExtensions.DeserializedImage(value);
            }
        }
    }
}
